In [1]:
import phreeqpython
pp = phreeqpython.PhreeqPython()
In [2]:
# Simple, through a reaction block
solution = pp.add_solution_simple({'CaCl2':1.0,'NaHCO3':2.0},temperature=15)
# Complex, allowing for more 'standard' PHREEQC input (Phreeqc example 3 -- Mixing)
solution2 = pp.add_solution({'units':'ppm',
'pH': 8.22,
'pe': 8.451,
'density': 1.023,
'temp': 25.0,
'Ca': 412.3,
'Mg': 1291.8,
'Na': 10768.0,
'K': 399.1,
'Si': 4.28,
'Cl': 19353.0,
'Alkalinity': '141.682 as HCO3',
'S(6)': 2712.0
})
In [4]:
print("Solution pH: {:.3}".format(solution.pH))
print("Solution sc: {:3.2f}".format(solution.sc))
print("Solution pe: {:.3}".format(solution.pe))
print("Temperature: {:.3}".format(solution.temperature))
print("Mass: {:.3}".format(solution.mass))
In [5]:
solution.species
Out[5]:
In [6]:
solution.elements
Out[6]:
In [7]:
solution.phases
Out[7]:
In [9]:
solution.total_element('Cl', units='mmol')
Out[9]:
In [10]:
solution.total('HCO3', units='mg') # equavalent to SUM_SPECIES
Out[10]:
In [11]:
solution.add('NaOH',1, 'mmol') # add 1 mmol of NaOH
solution.remove('NaCl',1, 'mmol') # remove 1 mmol of NaCl
solution.remove_fraction('CO3',0.5) # remove 50% of CO3
Out[11]:
In [13]:
solution.saturate('Calcite',1.0) # Saturate to SI 1.0
solution.desaturate('Calcite',0.0) # Desaturate to SI 0.0
Out[13]:
In [14]:
solution.change_ph(5,'HCl') # Change pH to 5 by dosing HCl
solution.pH
Out[14]:
In [16]:
solution.change_temperature(10) # Change temperature to 10 degrees
solution.temperature
Out[16]:
In [23]:
solution1 = pp.add_solution_simple({'NaCl':1})
solution2 = pp.add_solution_simple({'NaCl':3})
# make a solution of 50% solution 1 and 50% solution 2:
solution3 = solution1 * 0.5 + solution2 * 0.5
# make a solution by mixing solution 1 and 2 together
solution4 = solution1 + solution2
print("Solution 3:")
print("Total Chloride: {:.3} mmol".format(solution3.total('Cl')))
print("Mass: {:.3}".format(solution3.mass))
print("")
print("Solution 4:")
print("Total Chloride: {:.3} mmol".format(solution4.total('Cl')))
print("Mass: {:.3}".format(solution4.mass))
In [25]:
solution5 = solution4.copy()
print(solution5.sc)
In [26]:
solution5.forget()